Skip to content

Admin: Standardize mobile viewport heights for interactive elements#11750

Open
himanshupathak95 wants to merge 10 commits into
WordPress:trunkfrom
himanshupathak95:fix/64999-mobile-form-elements
Open

Admin: Standardize mobile viewport heights for interactive elements#11750
himanshupathak95 wants to merge 10 commits into
WordPress:trunkfrom
himanshupathak95:fix/64999-mobile-form-elements

Conversation

@himanshupathak95
Copy link
Copy Markdown

@himanshupathak95 himanshupathak95 commented May 7, 2026

Trac ticket: https://core.trac.wordpress.org/ticket/64999

This PR fixes inconsistent interactive element heights to 40px in the admin mobile viewport (≤782px) on:

  • Plugins > Add Plugin: search field, Keyword dropdown, Install button
  • Media Library > Grid: filter dropdowns, search field, Bulk select button
  • Settings > General: Custom date format and time format inputs

Follow-up to [62294].

Tested in Chrome at 782px viewport width (mobile emulation). Before/after
screenshots attached.

Screen / Component Before After
Add Themes > Search field Before Add Themes Search Field After Add Themes Search Field
Settings > General > Custom date/time format inputs Before Custom Date Time Inputs After Custom Date Time Inputs
Plugins > Add Plugin > Search field Before Plugin Search Field After Plugin Search Field
Plugins > Add Plugin > Keyword dropdown Before Plugin Keyword Dropdown After Plugin Keyword Dropdown
Media Library > Grid > Filter dropdowns Before Media Filter Dropdowns After Media Filter Dropdowns
Media Library > Grid > Search input Before Media Search Input After Media Search Input
Media Library > Grid > Bulk select button Before Bulk Select Button After Bulk Select Button

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@himanshupathak95 himanshupathak95 force-pushed the fix/64999-mobile-form-elements branch from dca69f9 to 220cc0c Compare May 8, 2026 08:53
@himanshupathak95 himanshupathak95 marked this pull request as ready for review May 8, 2026 08:56
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props abcd95, wildworks.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano force-pushed the fix/64999-mobile-form-elements branch from 220cc0c to 3f78edc Compare May 12, 2026 02:21
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! It looks good for the most part, but there are a few points that need further adjustment.


Media Library (List view): We should be able to use the button-compact class on these two buttons without writing any CSS.

Image

Install Themes: These buttons should be 32px in size.

Image

Install Plugins: These buttons should be 32px in size.

Image

Comment thread src/wp-admin/css/media.css Outdated
@himanshupathak95 himanshupathak95 force-pushed the fix/64999-mobile-form-elements branch from 3f78edc to 2545903 Compare May 12, 2026 07:23
@himanshupathak95 himanshupathak95 force-pushed the fix/64999-mobile-form-elements branch from 2545903 to c4e83fc Compare May 12, 2026 07:24
@himanshupathak95
Copy link
Copy Markdown
Author

Thanks @t-hamano for the suggestions and catching the leftovers.

I've tried to use classes and avoid hardcoding as much as possible.

Area Before After
Theme Activate Button Theme Activate Before Theme Activate After
Plugin Install Button Plugin Install Before Plugin Install After
Mode Before After
Grid Mode
Screen.Recording.2026-05-12.at.13.00.25.mov
Screen.Recording.2026-05-12.at.12.58.19.mov
List Mode
Screen.Recording.2026-05-12.at.13.00.43.mov
Screen.Recording.2026-05-12.at.12.57.58.mov

Copy link
Copy Markdown
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

Please note that on mobile layouts, the button height is generally 40px. Therefore, the button height in the following layout is incorrect.

Theme Activate Button:
Theme Activate After

Plugin Install Button:
Plugin Install After

The .buttom-compact class should also be usable in these areas.

if ( $this->is_trash && $this->has_items()
&& current_user_can( 'edit_others_posts' )
) {
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
submit_button( __( 'Empty Trash' ), 'apply button-compact', 'delete_all', false );

This is not directly related to this PR, but it would be good to standardize this button as well. Here's how to display this button.

Image

Comment on lines 1590 to 1595
.plugin-action-buttons li .button {
min-height: 32px;
line-height: 2.30769231; /* 30px for 32px min-height */
font-size: 13px;
padding: 0 12px;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On mobile layouts, the button height is not 40px.

Image

We should be able to remove these styles entirely and add the .button-compact class to the buttons within wp_get_plugin_action_button() function.

font-size: 14px;
vertical-align: middle;
min-height: 40px;
margin-bottom: 4px;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .wp-core-ui .button class applies to all buttons in the dashboard, so removing the bottom margin could have unintended consequences. Let's restore this bottom margin.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in [26386], these work perfectly when the input and button sizes were not 40px; now that they are, this creates a slight misalignment -

Screen.Recording.2026-05-13.at.13.57.06.mov

I checked the admin UI for any breaking changes, but could not find anything noticeable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My prediction is that this bottom margin is necessary to create a gap between the adjacent elements when the button wraps on mobile. If consumers have configured layouts that rely on this bottom margin, removing it could impact those layouts.

@himanshupathak95
Copy link
Copy Markdown
Author

Thanks @t-hamano for the reply.

Please note that on mobile layouts, the button height is generally 40px. Therefore, the button height in the following layout is incorrect.
The .button-compact class should also be usable in these areas.

I intentionally made them 32px in size since you asked the same in #11750 (review), specifically -

Install Themes: These buttons should be 32px in size.
Install Plugins: These buttons should be 32px in size.

I also feel like they should have .button-compact class and should be 40px for consistency, but your review suggested otherwise. So, just to be sure, we still want this to be 40px, right?

@t-hamano
Copy link
Copy Markdown
Contributor

I intentionally made them 32px in size since you asked the same in #11750 (review), specifically -

Install Themes: These buttons should be 32px in size.
Install Plugins: These buttons should be 32px in size.

I also feel like they should have .button-compact class and should be 40px for consistency, but your review suggested otherwise. So, just to be sure, we still want this to be 40px, right?

Apologies, there was an error in my explanation. What I meant to say is that all buttons should always be 40px on mobile. This means that a button with a 32px size in the desktop layout should change to a 40px size in the mobile layout. To achieve this, I wanted to suggest that the "button-compact" CSS class would be appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants